package com.htudata.station.service.impl ;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import java.util.function.Consumer;

import com.htudata.common.enums.RequestSeqEnum;
import com.htudata.convention.domain.ResponseResult;
import com.htudata.core.util.ResultGenerator;
import com.htudata.home.mapper.MntEqpMapper;
import com.htudata.station.dao.StationDao;
import com.htudata.station.service.StationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StationServiceImpl implements StationService {

  @Autowired
  private StationDao stationDao;
  
  @Autowired
  private MntEqpMapper mntEqpMapper;

  @Override
  public JSONArray getStationInfoByType(String stationType, long userId) throws Exception{
    JSONArray stationArray = this.stationDao.getStationInfoByType(stationType);
    JSONArray selectArray = this.mntEqpMapper.selectStationStatus(stationType, null, -1, userId);
    stationArray.stream().forEach((m)->{
      selectArray.stream().forEach((n)->{

      });
    });
    return stationArray;
  }

  @Override
  public String getStationInfoByTypeJSON(String stationType, long userId) throws Exception{
    ResponseResult responseResult = null;
    try {
      responseResult = ResultGenerator.genResult(RequestSeqEnum.SEQ_021.getCode(), getStationInfoByType(stationType, userId));
    } catch (Exception e) {
       throw e;
    } 
    String result = JSON.toJSONString(responseResult);
    return result;
  }
}
